<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查单</title>

<link rel="stylesheet" href="bn/css/labelling.css" type="text/css" />
<link rel="stylesheet" href="bn/css/sky-forms.css" type="text/css" />
<link rel="stylesheet" href="bn/css/font-awesome/css/font-awesome.min.css">
<!-- 手机、平板适配样式 -->
<link rel="stylesheet" href="bn/css/mscreen.css" type="text/css">
</head>
<body>
 <!--内容区开始-->
    <div class="paddtop30">
      <div class="container"> 
        <!--js切换页面开始-->
        <div class="two_third_one"> 
          <!--左侧导航开始-->
          <ul class="tabs">
          <!--   <li><a href="#demo-tab-1" target="_self">运单查询</a></li>-->
          </ul>
          <!--左侧导航结束--> 
          
          <!--右侧切换页开始-->
          <div class="tabs-content"> 
            <!--快件追踪开始-->
            <div id="demo-tab-1" class="tabs-panel">
              <form action="#" method="post" id="sky-form" class="sky-form">
                <fieldset style="padding-top:0;">
                  <div class="row">
            <section class="col col-6">
              <label class="textarea"> <i class="icon-append icon-search"></i>
                 <textarea rows="4" name="message" id="message" placeholder="运单编号"></textarea>
              </label>
            </section>

                  </div>
                </fieldset>
                <footer>
                  <button type="button" class="button" onClick="searchNo()">查询</button>
                </footer>
              </form>
              <!--运单查询列表-->
              <div class="ydline" id="loadData">
                
                
              </div>
            </div>
            <!-- end tab 1 --> 
            <!--快件追踪结束--> 
          </div>
          <!----> 
        </div>
        <!--右侧切换页结束--> 
      </div>
      <!--js切换页结束--> 
    </div>
 <script src="js/jquery.min.js"></script>  
 
<script type="text/javascript" charset="utf-8">
	var bill_no = "";
	function GetQueryString(name) {
	   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
	   var r = window.location.search.substr(1).match(reg);
	   if (r!=null) return unescape(r[2]); return null;
	}
	$(document).ready(function(){
		
	});
	function searchNo(){
			$("#loadData").empty();
			bill_no = $("#message").val();
			$.ajax({
		          type: 'GET',
		          url: "http://175.102.133.190:8383/A1_INTE/BillState/queryBillHistory.do?JSONDATA={'NO':"+escape(bill_no)+"}&USER_NAME=BNADMIN&PASSWORD=107",
		          async: false,
		          dataType: "json",
		          jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(一般默认为:callback)
		          jsonpCallback:"callback",//自定义的jsonp回调函数名，默认未jquery自动生成的随机函数名，也可以写“?”jquery会自动处理
		          success: function(result){
			          $("#span_ydhm").html(bill_no);
			          var billno = "";
	              		//快件状态
	              		var statusHtml ="";
	              		//物流详情
	              		var interHtml= "";
	              		//是否揽收
	              		var yls="";
	              		//运输途中
	              		var ysz="";
	              		//派件中
	              		var pjz="";
	              		//已签收
	              		var yqs="";
	              		var errHtml="";
	              		if(result.returnType=="SUCCESS"){
		              		if(result.returnValue.length>0){
			              		$.each(result.returnValue, function(i, n){
				              		    if(i==0||(billno!=""&&billno!=n.BILL_NO)){
					              		    if(i!=0){
						              		    interHtml+=  '                  </tbody>                                     ';
												interHtml+=  '                </table>                                       ';
												interHtml+=  ' </div>                                                        ';
					              		    }
					              		    interHtml+=  '<div class="ydnm">运单号码：<span id="span_ydhm">'+n.BILL_NO+'</span></div>   ';
											interHtml+=  '                <div  class="bill_content">                    ';
											interHtml+=  '	                <table class="result-info2" id=“tb_billhis”> ';
											interHtml+=  '                  <thead>                                      ';
											interHtml+=  '                    <tr>                                       ';
											interHtml+=  '                      <th>时间</th>                             ';
											interHtml+=  '                      <th class="ydlinebg">&nbsp;</th>         ';
											interHtml+=  '                      <th>操作部门</th>                    ';
											interHtml+=  '                      <th>地点和跟踪进度</th>                    ';
											interHtml+=  '                    </tr>                                      ';
											interHtml+=  '                  </thead>                                     ';
											interHtml+=  '                  <tbody id="loadData">                        ';
				              		    }
				              			interHtml+='  <tr>                                                           ';
				              			interHtml+=' <td class="row1">'+n.OPERATETIME+'</td>                         ';
				              			if(i==0||(billno!=""&&billno!=n.BILL_NO)){
					              			 interHtml+=' <td class="status-first">&nbsp;</td>                        ';
				              			}else{
					              			interHtml+=' <td  class="status ">&nbsp;</td>                        ';
				              			}
				              			
				              			interHtml+=' <td>'+n.OPERATEDEP+'</td>                                      ';
				              			interHtml+=' <td>'+n.REMARK+'</td>                                      ';
				              			interHtml+=' </tr>                                                       ';
				              			if(result.returnValue.length==(i+1)){
					              			interHtml+=  '                  </tbody>                                     ';
											interHtml+=  '                </table>                                       ';
											interHtml+=  ' </div>                                                        ';
				              			}
				              			billno = n.BILL_NO;
				              	})
				              	$("#loadData").append(interHtml);
			                }
		                }
		          }
   			 });
	}
</script>
</body>
</html>
